Skip to main content

Observer Class

Description:

  A class for creating Observer objects.

Observer.EntityEvent

Type: Enumeration.

Description:

  The types of entity events that an observer can watch for.

Signature:

enum EntityEvent

-- The addition of a new entity.
"Add"

-- The modification of an existing entity.
"Change"

-- The addition or modification of an entity.
"AddOrChange"

-- The removal of an existing entity.
"Remove"
end

__call

Type: Metamethod.

Description:

  A metamethod that creates a new observer with the specified component filter and action to watch for

Signature:

metamethod __call: function(self: ObserverClass, event: EntityEvent, components: {string}): Observer

Parameters:

ParameterTypeDescription
eventEntityEventThe type of entity event to watch for.
components{string}A table listing the names of the components to filter entities by.

Returns:

Return TypeDescription
ObserverThe new observer.